package com.dy.course.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSON;
import com.dy.course.common.BaseController;
import com.dy.course.common.ResponseMessage;
import com.dy.course.entity.AppBean;
import com.dy.course.model.App;
import com.dy.course.service.IAppService;

@Controller
public class AppController extends BaseController{
	@Autowired
	private IAppService appService;
	
	@RequestMapping(value = "/app/select")
	@ResponseBody
	public ResponseMessage<App> qureyUser(AppBean ab){
		logger.info("【版本信息】,参数信息，ab="+JSON.toJSONString(ab));
		List<App> lst = appService.selectApp(ab);
		return constructResponse(lst.get(0));
	}
	
	@RequestMapping(value = "/app/update",method = RequestMethod.POST)
	@ResponseBody
	public ResponseMessage<?> insert(@RequestBody AppBean ab){
		logger.info("【版本信息】参数信息,ab="+JSON.toJSONString(ab));
		appService.insertApp(ab);
		return constructNullResponse();
	}
}
